<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>商品详情</title>
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <style type="text/css">
        .aui-bar-nav {
            /*padding: 0 11px 0 13px;
        box-sizing: border-box;*/
            top: 0;
            line-height: 2.25rem;
            background-color: #fff;
            color: #ffffff;
            border: none;
            background-size: 100% 1px;
            background-repeat: no-repeat;
            background-position: bottom;
            background-image: linear-gradient(0, #EEEEEE, #EEEEEE 50%, transparent 50%);
            background-image: -webkit-linear-gradient(90deg, #EEEEEE, #EEEEEE 50%, transparent 50%);
        }

        .aui-bar-nav .aui-btn .aui-iconfont {
            font-size: 0.9rem;
            line-height: 1.25rem;
            padding: 0;
            margin: 0;
            color: #000000;
        }

        .aui-bar-nav .aui-title {
            min-height: 2.25rem;
            position: absolute;
            margin: 0;
            text-align: center;
            white-space: nowrap;
            right: 5rem;
            left: 5rem;
            width: auto;
            overflow: hidden;
            text-overflow: ellipsis;
            z-index: 2;
            color: #333333;
            font-size: 17px;
            font-weight: bolder;
        }

        .aui-btn span {
            width: 22px;
            height: 22px;
        }

        .aui-btn span img {
            width: 22px;
            height: 22px;
        }

        .aui-bar-nav .aui-pull-right {
            padding: 0 11px;
            font-size: 0.8rem;
            font-weight: 400;
            z-index: 2;
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
            display: -webkit-box;
            display: -webkit-flex;
            display: flex;
            -webkit-align-items: center;
            align-items: center;
        }

        button,
        .aui-btn {
            position: relative;
            display: inline-block;
            font-size: 0.7rem;
            font-weight: 400;
            font-family: inherit;
            text-decoration: none;
            text-align: center;
            margin: 0;
            background: #EEEEEE;
            padding: 0 15px!important;
            height: 1.5rem;
            line-height: 1.5rem;
            border-radius: 0.2rem;
            white-space: nowrap;
            text-overflow: ellipsis;
            vertical-align: middle;
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
            -webkit-user-select: none;
            user-select: none;
        }

        .aui-pull-right {
            font-size: 15px;
            color: #222222!important;
            text-align: right;
        }

        footer {
            width: 100%;
            padding: 0 17.5px;
            background: #fff!important;
            box-sizing: border-box;
            border: none;
            background-size: 100% 1px;
            background-repeat: no-repeat;
            background-position: top;
            background-image: linear-gradient(0, #EEEEEE, #EEEEEE 50%, transparent 50%);
            background-image: -webkit-linear-gradient(90deg, #EEEEEE, #EEEEEE 50%, transparent 50%);
            /*opacity: 0.1;*/
        }

        .aui-bar-tab {
            position: fixed;
            top: auto;
            /*padding: 5px 17.5px;*/
            table-layout: fixed;
            justify-content: space-between;
            display: flex;
            background-color: #fff!important;
        }

        .operation {
            display: flex;
            width: 100%;
            flex: 1;
            justify-content: space-between;
            align-items: center;
        }

        .operation div {
            flex: 1;
        }

        .operation div span {
            display: block;
            text-align: center;
            font-size: 12px;
            font-family: PingFang SC;
            font-weight: 400;
            color: #333333;
        }

        .operation div span.icon {
            display: block;
            width: 19px;
            height: 19px;
            /*border: 1px solid red;*/
            /*margin: 0 auto;*/
            /*margin-top: 3.5px;*/
        }

        .operation div span.icon img {
            display: block;
            width: 100%;
            height: 100%;
        }

        .operation div span.text {
            margin-top: 3.5px;
            text-align: left;
        }

        .cashback {
            display: flex;
            width: 200px;
            margin-left: 28px;
            align-items: center;
        }

        .cashback_l {
            height:40px;
            line-height: 40px;
            background: linear-gradient(-90deg, #FC3653, #F87721);
            border-radius: 20px 0px 0px 20px;
            flex: 1;
            color: #fff;
            font-size: 14px;
        }

        .cashback_l span {
            display: block;
            height: 15px;
            line-height: 15px;
            font-size: 14px;
            font-family: PingFang SC;
            font-weight: 500;
            color: #FFFFFF;
        }

        .cashback_l span:first-child {
            margin-top: 3.5px;
        }

        .cashback_r {
            height:40px;
            line-height:40px;
            flex: 1;
            background: linear-gradient(-90deg, #7619EC, #A429F3);
            border-radius: 0px 20px 20px 0px;
            font-size: 14px;
            font-family: PingFang SC;
            font-weight: 500;
            color: #FFFFFF;
        }

        .cashback_r span {
            display: block;
            height: 15px;
            line-height: 15px;
            font-size: 15px;
            font-family: PingFang SC;
            font-weight: 500;
            color: #FFFFFF;
        }

        .cashback_r span:first-child {
            margin-top: 3.5px;
        }
    </style>
</head>

<body>
    <div id="app">
        <!-- <header class="aui-bar aui-bar-nav" id="header">
            <a class="aui-pull-left aui-btn" tapmode @click="closeWin()">
                <span>
                   <img src="../../image/back_arrow.png" alt="">
                </span>
            </a>
            <div class="aui-title">商品详情</div>
        </header> -->
        <footer class="aui-bar aui-bar-tab" id="footer">
            <div class="operation">
                <div class="operation_l" @click='backindex()'>
                    <span class="icon" style="margin:0 auto;"><img src="../../image/details_index_icon.png" alt=""></span>
                    <span class="text" style="text-align:center;">首页</span>
                </div>
            </div>
            <div class="cashback">
                <div class="cashback_l" @click='copyCommand()'>复制链接
                    <!-- <span>¥1.14</span> -->
                    <!-- <span style="margin-top:8px;">分享</span> -->
                </div>
                <div class="cashback_r" @click='GetCoupon()'>领券购买
                    <!-- <span>¥1.14</span>  -->
                    <!-- <span style="margin-top:8px;">领券购买</span> -->
                </div>
            </div>
        </footer>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/vue.js"></script>
<script type="text/javascript" src="../../script/cling.js"></script>
<script type="text/javascript">
    apiready = function() {
        cl.apiready();
        cl.openFrame({
            name: './jd_goods_deatils_frame',
            header: header,
            footer: footer,
            bounces: false,
            bgColor: "#FAF9F9",
            pageParam: {
                id: api.pageParam.id,
                index: api.pageParam.index
            }
        });

        // vm.getCommand()

    };
    var vm = new Vue({
        el: "#app",
        data: {
          cvalue:''
        },
        methods: {
          backindex:function(){
            api.sendEvent({
                name: 'backindex'
            });
            cl.closeToWin({
                name: 'root'
            });
          },
          copyCommand: function() {
            api.ajax({
                url: cl.apiServer + 'jd/getUnionurl',
                method: 'post',
                headers: {
                    'Content-Type': 'application/json;charset=utf-8',
                    token: cl.userToken
                },
                data: {
                    body: {
                        goodsId: api.pageParam.id,
                        type: 1,
                        version:cl.deviceInfo().appVersion,
                        mobileInfo:cl.systemType()
                    }
                }
            }, function(ret, err) {
                if (ret) {
                    // alert(JSON.stringify(ret));
                    // vm.cvalue = ret.data;
                    cl.openAlert({
                        title: '复制链接购买',
                        content:ret.data,
                        rightBtnTitle: '立即复制'
                    }, function(res) {
                        if (res.eventType === "right") {
                            var clipBoard = api.require('clipBoard');
                            clipBoard.set({
                                value:ret.data
                            }, function(ret, err) {
                                if (ret) {

                                }
                            });
                            cl.toast({
                                msg: '已复制到剪切板'
                            });

                        }
                    })

                }
            });


          },
            closeWin: function() {
                cl.closeWin({
                    name: 'jd_goods_deatils'
                })
            },
            GetCoupon: function() {
              api.ajax({
                  url: cl.apiServer + 'jd/getUnionurl',
                  method: 'post',
                  headers: {
                      'Content-Type': 'application/json;charset=utf-8',
                      token:cl.userToken
                  },
                  data: {
                      body: {
                          goodsId: api.pageParam.id,
                          type: 1,
                          version:cl.deviceInfo().appVersion,
                          mobileInfo:cl.systemType()
                      }
                  }
              }, function(ret, err) {
                  if (ret) {
                      console.log(JSON.stringify(ret));
                      if (ret.code == 0) {
                          cl.openWin({
                              name: '../../brower_',
                              pageParam: {
                                  link: ret.data
                              }
                          });
                      }
                  }
              });

            }

        }
    })
</script>

</html>
